#ifndef __MOTOR_H
#define __MOTOR_H

#include <Encoder.h>
#include <msp430.h>
#include <PWM.h>
#include "stdint.h"
#include "stdio.h"
#include "SystemClock.h"

#define PWMA    TA1CCR1  //P1.2
#define PWMB    TA1CCR2  //P1.3
/*
 * AIN1 --> P1.2
 * AIN2 --> P1.6
 */
#define AIN1_H   P1OUT |= BIT2;
#define AIN2_H   P1OUT |= BIT6;
#define AIN1_L   P1OUT &= ~BIT2;
#define AIN2_L   P1OUT &= ~BIT6;

/*
 * BIN1 --> P2.2
 * BIN2 --> P2.6
 */
#define BIN1_H   P2OUT |= BIT2;
#define BIN2_H   P2OUT |= BIT6;
#define BIN1_L   P2OUT &= ~BIT2;
#define BIN2_L   P2OUT &= ~BIT6;


void Motor_Init(void);
void Set_PWM(int motor1,int motor2);
int myabs(int a);
void Xianfu_Pwm(int motor1,int motor2);
void Turn_Off(float angle, float voltage);

#endif
